home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Singles Flirt Up Your Life! (German)
/
Singles Flirt Up Your Life.iso
/
data1.cab
/
Statemachine
/
movingCarton.lua
< prev
next >
Wrap
Text File
|
2004-01-29
|
2KB
|
59 lines
-- moving carton state machine
beginStateMachine()
onEnter(function(msg)
-- kinda cant be removed afterwards *sob*
--storeData("empty",true);
end )
onMsg("buildMenu", function(msg)
if (repairMenu()) then return end
-- rebuild the pie menu
clearPieMenu()
if (retrieveData("empty") and retrieveData("empty")~=1) then
-- hier fehlt ne abfrage ob man im richtigen tutorial ist und auspacken darf
local button = addPieMenuButton("pm_unpack", "unpack");
button.addDescription(DONTQUEUE, "true");
end
end )
--
onMsg("unpack", function(msg)
-- get the game object server
local gameObjectServer = getGameObjectServer();
-- get character who initiated this action
local character = getStateObjectFromID(msg.sender);
-- if this is broken: abort characters action
if abortIfBroken(character) then return end;
-- walk to the closest action point
--local actionPoint = character.getFreeActionPoint(this, "unpack");
local actionPoint = this.getActionPoint("unpack");
-- get the walk state object
local wso = character.walkSO;
-- create state machine contexts
local wsoContext = StateMachineContext();
-- store the action point
wsoContext.storeData("actionPointName", actionPoint.getName());
-- switch to life mode
local editor = this.getGameObjectServer().getEditor();
editor.setMode(Editor.LIFE_MODE);
wso.walkToActionPoint(actionPoint);
-- enque action
wso.queueStateMachine("movingCartonChar.unpack", this, wsoContext);
end )
endStateMachine()